package com.cloudfun.campusshare.repo;

import com.cloudfun.campusshare.entity.PromotionProductType;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import java.util.List;

/**
 * Created by CodeGenerator on 2020/06/06
 */
public interface PromotionProductTypeRepo extends PagingAndSortingRepository<PromotionProductType, String>,JpaSpecificationExecutor<PromotionProductType>{

    List<PromotionProductType> findAllByPromotionId(String promotionId);

    @Modifying
    @Query(value = "delete from promotion_product_type where promotion_id=?",nativeQuery = true)
    void deleteByPromotionId(String promotionId);
}